package org.coder.nacos_config;

/*import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;*/

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.util.concurrent.TimeUnit;

@SpringBootApplication
public class NacosConfigApplication {

    public static void main(String[] args) throws InterruptedException {
        ConfigurableApplicationContext context = SpringApplication.run(NacosConfigApplication.class, args);
        ConfigurableEnvironment environment = context.getEnvironment();
        while(true) {
            String name = environment.getProperty("users.name");
            String age = environment.getProperty("users.age");
            System.out.println("name: " + name + ", age: " + age);
            TimeUnit.SECONDS.sleep(2);
        }
    }

}
